home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / overwrt.exe / OVERWRT.PAS < prev    next >
Pascal/Delphi Source File  |  1992-10-12  |  2KB  |  93 lines

  1. Program EditOverwrite;
  2.  
  3. {$R OVERWRT.RES}
  4.  
  5. Uses
  6.   WObjects, WinTypes, WinProcs, Strings, Ovrtpu;
  7.  
  8. const
  9.   AppName = 'OverWrt';
  10.  
  11. (* Test Defines *)
  12.   Id_Edit      = 100;
  13.  
  14. (* Menu Defines *)
  15.   Cm_About        = 100;
  16.   Cm_Test         = 101;
  17.  
  18.   AboutDlg        = 'ABOUT';
  19.   TestDlg         = 'TEST';
  20.   MenuName        = 'MAINMENU';
  21.   IconName        = 'MAINICON';
  22.  
  23. type
  24.   TEditApplication = object(TApplication)
  25.     procedure InitMainWindow; virtual;
  26.   end;
  27.  
  28.   PTestDlg = ^TTestDlg;
  29.   TTestDlg = object(TDialog)
  30.     Editor : POverwrite;
  31.     Constructor Init(AParent : PWindowsObject; AName : PChar);
  32.   end;
  33.  
  34.   POvrWriteWindow = ^TOvrWriteWindow;
  35.   TOvrWriteWindow = object(TWindow)
  36.     constructor Init(AParent : PWindowsObject; AName : PChar);
  37.     procedure GetWindowClass(var AWndClass : TWndClass); virtual;
  38.     procedure Test(var Msg : TMessage);
  39.       virtual cm_First + cm_Test;
  40.     procedure About(var Msg : TMessage);
  41.       virtual cm_First + cm_About;
  42.   end;
  43.  
  44. (********************)
  45. (* TEditApplication *)
  46. (********************)
  47. procedure TEditApplication.InitMainWindow;
  48. begin
  49.   MainWindow:=New(POvrWriteWindow, Init(nil,'OverWrite Demo'));
  50. end;
  51.  
  52. (************)
  53. (* TTestDlg *)
  54. (************)
  55. constructor TTestDlg.Init(AParent : PWindowsObject; AName : PChar);
  56. begin
  57.   TDialog.Init(AParent, AName);
  58.   Editor:=New(POverwrite, InitResource(@Self,ID_EDIT,100));
  59. end;
  60.  
  61. (*******************)
  62. (* TOvrWriteWindow *)
  63. (*******************)
  64. constructor TOvrWriteWindow.Init(AParent : PWindowsObject; AName : PChar);
  65. begin
  66.   TWindow.Init(AParent, AName);
  67.   Attr.Menu:=LoadMenu(Hinstance,MenuName);
  68. end;
  69.  
  70. procedure TOvrWriteWindow.GetWindowClass(var AWndClass : TWndClass);
  71. begin
  72.   TWindow.GetWindowClass(AWndClass);
  73.   AWndClass.HIcon:=LoadIcon(HInstance, IconName);
  74. end;
  75.  
  76. procedure TOvrWriteWindow.Test(var Msg : TMessage);
  77. begin
  78.   Application^.ExecDialog(New(PTestDlg,Init(@Self,TestDlg)));
  79. end;
  80.  
  81. procedure TOvrWriteWindow.About(var Msg : TMessage);
  82. begin
  83.   Application^.ExecDialog(New(PDialog,Init(@Self,AboutDlg)));
  84. end;
  85.  
  86. (**** MAIN ****)
  87. var
  88.   EditApp : TEditApplication;
  89. begin
  90.   EditApp.Init(AppName);
  91.   EditApp.Run;
  92.   EditApp.Done;
  93. end.